class Solution {
    func twoSum(_ nums: [Int], _ target: Int) -> [Int] {
        var mutnums: [Int: Int] = [:]
        for (index,num) in nums.enumerated(){
            mutnums[target - num] = index
        }
        for (index,num) in nums.enumerated(){
            if mutnums[num] != nil &&  mutnums[num] != index {
                return [index,mutnums[num]!]
            }
        }
        return []
    }
}
